package com.eastshop.category.service;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.eastshop.category.dao.CategoryDao;
import com.eastshop.category.vo.Category;
/*
 * 商品分类的Service
 */
@Transactional
public class CategorySerive {
	// 注入CategoryDao
	private CategoryDao categoryDao;

	public void setCategoryDao(CategoryDao categoryDao) {
		this.categoryDao = categoryDao;
	}

	// Service层查找所有的商品分类
	public List<Category> find() {
		return categoryDao.find();
	}

	// Service层根据id查询商品的分类
	public Category findByCid(Integer cid) {
		Category category = categoryDao.findByCid(cid);
		return category;
	}

	// Service层删除商品的分类
	public void delete(Category category) {
		categoryDao.delete(category);
	}

	// Service层保存商品的方法
	public void save(Category category) {
		categoryDao.save(category);
	}

	// Service层更新商品分类的方法
	public void update(Category category) {
		categoryDao.update(category);
	}
	
}
